package com.xigua.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/3/1023:20
 */
public class StringUtils {

    public static Map<Character,Integer> countChar(String s){
        Map<Character,Integer> hashMap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char key = s.charAt(i);
            if (hashMap.containsKey(key)) {
                hashMap.put(key, hashMap.get(key)+1);
            }else {
                hashMap.put(key,1);
            }
        }
        return hashMap;
    }

}
